I think you could be looking at muscle spasms, but I think there may also be a component of how you are performing your squats. If your knees are drifting too far forward doing squats it is possible your are activating the muscle unintentionally resulting in spasms that force you to stop the squat.
The thought about the vitamin and mineral imbalances is a good thing to check out, but another consideration is again with body mechanics in protecting your back. Its possible (no way of telling without a medical exam) that in the deep squat position you could place pressure on the nerve in your spine that is linked to the muscles of the leg. Be sure to keep your abs tight through the full squat and see if it still happens.
I know this post is a little older, but I hope that you are feeling better.