Chemistry - How are N95 masks different from dust masks?
The short answer to your question "What's the science behind the N95 filter?" is that it is what's called a tortuous path filter, removing particulates from a flow of contaminated air by impact and absorption of the particulate onto the filter material or by trapping particles of sufficient size between the fibers constituting the filter.
The term N95 comes from the NIOSH (National Institute for Occupational Safety and Health, a body of the US government) rating where the 95 means that the material is certified to block 95% of particles 0.3 μm or larger in diameter. The limiting factor toward achieving the stated level of performance during usage is how well the mask seals to the face of the user. Whiskers, dirt and improper fit can all allow a larger portion of particles to circumvent the filter material. The image in the OP shows a mask having a valve to facilitate breathing and maintain a seal by opening during the exhale portion of a breath.
From official 3M Q&A brochure (emphasis mine):
Can N95 respirators filter particles that are really small like smoke, soot and ash?
Yes. Particulate filters employ multiple mechanisms that are effective at filtering a range of particles that include those so small you cannot see them. In fact, as part of their certification process, NIOSH tests particulate respirators against submicron particles in the size ranges of smoke, soot and ash.
I guess if you want to participate in firefighting activities or there is a chance you might need to escape areas with high fire smoke concentration you need an oxygen mask with eye and face protection (or SCBA – self-contained breathing apparatus) instead.
The principle on which they depend isn't that different. This does not mean, however, that you can wear a dust mask instead of an N95.
From the Review article of "Respiratory Protection" from the New England Journal of Medicine:
The most commonly recommended respirator in the health care setting is the N95: “N” means “not oil-proof,” and “95” means that it is at least 95 percent efficient at filtering particles with a median diameter of greater than 0.3 μm. Higher numbers indicate greater filtering efficiency.
So it is a good mask for particulates. However, according to OSHA, it won't protect you against gases and vapors.
Filtering facepiece respirators filter out particles and do not protect against non-particulate hazards such as gases or vapors.
So it may not be the best mask to wear when you are near the site of the fire. The best type of respirator is the one which has its own oxygen source. However, these are expensive.