Can you explain how this expression follows the grammar of the lambda calculus?
$$\lambda x.x((\lambda y.yy)x)x = λx.x(xx)x$$
I am not sure why we have the parentheses following the $.x$ (on both sides of the equation).
When in doubt, write down a lot of parentheses: $$\lambda x . ((x ((\lambda y . ((y y) x)) x)) x)$$ and $$\lambda x . ((x (x x)) x)$$ In $\lambda$-calculus there is the convention that $A B C$ is understood to be $(A B) C$, that is, application associates to the left. So, if somebody wants to $A (B C)$ instead, they have to put in some parentheses.