Upset stomach, tummy aches, and altered bowel habits (for example, diarrhea) are common complaints for children of all ages.
Younger children, like your grandson, are especially bothered by the cramps. They are bothered by the straining that can happen with having any bowel movement.
Doctors frequently look for the reason why a child is having these complaints. They do not always find out why.
Infection is a common cause, but it usually gets better on its own quickly. Plus, the symptoms would tend to be there every day until it goes away.
Maybe his problem is constipation or just holding back his poop. This can often give him crampy belly pain on and off. Plus, he might be leaking liquid around his hard stool from his bottom.
His symptoms also could be from something that is not being digested normally. This could be due to lactose intolerance, celiac disease, or food allergies.
His symptoms may come and go from one day to the next depending upon what he is eating on the days he is having symptoms.
I would not recommend any over-the-counter medicines to stop his belly pain or change his diarrhea. You would not want to cover up anything serious.
Talk with his doctor to help make a clearer diagnosis first. The doctor can recommend any diet changes, specific medicines, or bowel training as needed.