Why not talk to his grandmother when he cannot hear, and set it up to ask her to leave if he won't behave. If you plan it in advance, she shouldn't be offended. Let your son know that if he can't behave while grandma is visiting that you will ask her to leave. Then do it. Make a point of letting your son know that this is because of his behavior. (Now, if it was my kids, they would promise to behave, and I would let them know that they won't get another chance. Second time, I'd follow through. Not everyone gives second chances, though.) If grandma has to leave early one time, I bet the behavior will improve immediately. My kids would do anything rather than offend their grandmother! Hopefully your mother-in-law will work with you on this. Good luck, and let us know how it turned out.
Since I wrote this I've noticed that a lot of people are kind of blaming the grandmother. I don't think being spoiled by a grandmother in limited amounts will damage your kids as long as you are clear with your expectations at home. He obviously knows that this behavior is only ok around grandma, and it gives him a little "break" so to speak. My mother-in-law can spoil our kids however she wants, but she has to deal with them if they won't behave for her.