Question: is it grammatically correct to say thank you so much?
Answer: Both are equally useful, as is just plain "Thank you", "Thanks", "Many thanks", and other variations. I do agree with @JohnPeyton that "Thank you very much" is a little more formal, and "Thank you so much" is less formal.