if you smoke, eat alot of spicy food, and drink alot of soda it could be pockets that are forming in your esophagus. a friend of mine had this.
what happened is the soda and smoking wore out spots in his throat. he would regularly eat a snack just before bed too. ths doctor told him that that food wasnt getting fully "swallowed" and catching in these "pockets". it would then congeal or something, and he would cough out these yellowish foul smelling and tasting bits.
they were particles of things like ground beef that had been sticking in his throat for a week and finally getting forced out.
he's on treatment for the holes and has to take some super antacid. he also can not eat anything "hot" tempature or spice. no soda, no smoking, no beer, and foods like ground beef with small hunks has to be avoided.