factorize

-> 3a^2 +6a^2 x^2 - 3a^3 x ????

Factor out 3a^2:

3a^2(1+2x^2-ax)

That's about as far as we can go.

Now, if you had started out with
3a^4 - 6a^3x + 3a^2x^2,
you'd have 3a^2(x-a)^2