Example 5 Find all functions $f: \mathbf{R} \rightarrow \mathbf{R}$, such that for all $x, y \in \mathbf{R}$, we have
$$
\begin{array}{l}
f(x+y) f(x-y) \\
=(f(x)+f(y))^{2}-4 x^{2} f(y) .
\end{array}
$$
Let $x=y=0$, we get
$$
f^{2}(0)=4 f^{2}(0) \text {. }
$$

Thus, $f(0)=0$.
Let $x=y \neq 0$. Then
$$
0=4 f^{2}(x)-4 x^{2} f(x) \text {. }
$$

Hence, $f(x)=0$ or $f(x)=x^{2}$.
Upon verification, $f(x)=0$ or $f(x)=x^{2}$ satisfy the original equation.