Was his cough explained in the canon Clone Wars? I know in the 2003 version it was, but I'm unsure of the CGI Clone Wars. I was unable to find it on Wookieepedia.
He more or less obtains it in the episode "Lair of Grievous"
In the 10th episode of Season 1 of the The Clone Wars (the CGI canon series), Grievous has his legs chopped off by the Jedi Master Kit Fisto.
Grievous' horrific injuries are repaired by his medical droid A4-D, but he isn't the same afterwards — in particular, he develops a noticeably persistent hacking cough.
Truth be told, he seems to have a mild cough from the beginning of The Clone Wars (with no explanation), but it is clearly far worse after episode 10. It seems to be something that accumulates with his injuries.
(Thanks @WadCheber for the video.)