Is he retching, like he's going to throw up or coughing?
Unproductive retching could be a sign that he's eaten something he can't pass. If you don't see poop or vomit for 8 hours OR if he acts like he's in pain call the vet.
If it's coughing, it could be a number of things. Kennel cough sounds like deep wheezy, hacking coughs often producing phlegm. If he's been to the vet, kennel, groomer or around other dogs who have, this could be a possibility...even if he's vaccinated, since the kennel cough vaccine is not effective against all strains.
Like the above poster said, he could just have grass in his throat...hopefully not in his nose. My dogs sometimes do this if they get into the chicken feed.
If he's snorting like a pig...it's a reverse sneeze. If he'll let you, cover both nostrils with your fingers. This will force him to breathe through his mouth which sometimes clears it. Also try massaging the top of his nose right between the eyes.