S.H.
You need to start teaching him, that everyone is different.
That, getting things/treats from someone, does not make someone "better" or worse, than the other.
When my kids were in Preschool, younger than your son, they taught the kids that. And from when my kids were Toddlers, we began teaching our kids that too. ie: they have a VERY generous Aunt that buys them anything. Then we have another Aunt, that is more conservative. But because we always taught our kids that "love" is not based on "things" or what a person buys you all the time... they KNOW... that both Aunts love them and are "FUN" in their own ways. We taught... our kids that. AND we taught them... that "comparing" both Aunts is not nice... that comparing people based on what they buy you or give you, is not, nice or fair.
A child... NEEDS TO be guided... on things like that. It is a life lesson.
Please let Grandma know, that he is also young. And certainly, she should not have to feel that she is "competing" with the other grandparents. If she feels that way, that is.
Then, try ASKING YOUR SON (since he is 5 after all), "why" he is not as friendly... with Grandma now??? Just conversing with him about it. Don't put your judgment in there, just see what HE says.
You need to see, what he says himself, about it. Maybe there is a reason. Or not. But just ASK your son. This has been going on for about 1 year, as you said.
Or, would it be possible... that the other set of Grandparents... bad mouth your Grandmother?????? Sometimes, Grandparents can be petty like that... and try to make a grandchild, like them better over the other one.... by downplaying the other Grandparent, to the child. Of course, this is not nice.
You cannot "force" your son to show more affection to your Grandmother. But if I were you, I would start guiding him and talking to him... about, how everyone is different... but you all are family, and everyone loves him. And love is not shown by just buying things for him all the time. It is also about, just enjoying their company, too, etc.