You did nothing. Check with his parents, but that is what children do at that age.
My DGS at much the same age suddely decided that grandpa was everything and grandma was of no interest and would side swerve me to greet his grandfather when we arrived at their house.
I think this stage lasted a year or so, but some six years later roughly, we have the happiet and closest of relation ships and have had for most of that time.
Too many grandmothers invest too much of themselves in their grandchildren. Young children are prone to what we see as irrationlal behaviour, but they get over it.