As kurnal said the nasal passages and nasal hair filter the air and remove the smoke particles. This helps to stop them irritating the throat and lungs and prevents coughing. However it is only effective against smoke particles. There was another technique where you chewed the air, the aim was to get the particles trapped by the silivia. This technique was used by firefighters up to the availability of the Compressed Air sets as an alternative to the old oxygen sets that took ages to service after a job.
In Victorian times the story is that they used to stuff their beards into their mouth and hold it place with a handky (preferably red and spotted).
These techniques worked when the smoke came from tradition furniture and there were less poisonous gasses. Nowadays it is a different matter.
Yes breathing through your nose may help.