for most of this movie I was thinking: "Why is that robot coughing? thats so dumb"
and then later: "oh, ok"
I was thinking that too! I wanted it to stop.
I did that for a second too. Then they did a close-up of the Grevious' eyes to show you that he was actually ORGANIC under the armor. We don't know exactly how much flesh is there, but he probably got jacked up and then was fitted with cybernetic parts to keep him alive. The new parts I guess didn't cure his coughing fits.
In the clone wars cartoons, Greivous encounters Mace Windu and gets his torso crushed while he kidnaps Palpatine, hence the coughing fits.