Most fasteners have a coating. This can be zinc, copper-plated, galvanized, lacquered, chromated, etc. One coating provides better rust protection than the other.
If the fasteners are exposed to weather conditions or, for example, salt water, it is recommended to use stainless steel fasteners. It is often thought that stainless steel is harder than normal steel, but this is based on a misunderstanding. It's even slightly softer.
Stainless steel fasteners are often used in sustainable construction. In the coastal provinces, where fasteners also have to do with the salt from the seawater, it is also recommended to use stainless steel.