Your problem could not be solved, because production rules themselves could not define a formal language.
Below is the reason:
Given Σ is an alphabet set, Σ* is worlds over alphabet Σ, A formal language L is a subset of Σ*. Basing on your input, "x + y - z" or "x - x - x", Σ is ambiguous. Is it set {'x', '+', 'y' '-', 'z', ' '} or set {'x +', 'x -', 'x', '+ y', '-z ', ' '}?
A formal grammar is a tuple G = (N, Σ, P, S) and the P is build on N and Σ. With ambiguous Σ, N could not be defined (it must be disjointed with Σ) and P could not be built.
An example for this ambiguous is as link Minimal regular expression that matches a given set of words:
Regular expressions: /mãe|mae/ has Σ = {'mãe', 'mae'} whereas
/ma[ãa]e/ has Σ = {'ma', 'ã', 'a', 'e'}, but both expressions generate
same language.
You could define your alphabet set as Σ = {'x + y - z', 'x + y - z'} and end up with an un-useful rules like below, because of its huge quantities:
S ⟶ 'x + y - z'
S ⟶ 'x + y - z'