Very important question - a lot of misconception about the use of S/S in marine applications.
All the above info
Here is my tuppence worth - A4 (316) has a far greater resistance to salt water corrosion. The rough rule of thumb within the marine industry is A2 (304) above the waterline, A4 below. In general however, A4 is the best grade in salt water applications.
Now the science bit (not again) - the corrosion resistance S/S depends on the addition of chromium to form chromium oxide
on the surface to keep corrosion at bay. However chromium is a carbide former and it wants to produce chromium carbide
which means less chromium oxide.
A4 is a "proofed" S/S which reduces the formation of the bad chromium carbide and potentially more good chromium oxide than A2.
However the downside of this is a reduction in mechanical properties ie a A4 (316) bolt has approx 1/3 the strength of an equivalent high tensile steel bolt and is a lot more brittle.
Finally be very wary of using any S/S below the waterline as there is also very little oxygen to maintain the vital chromium oxide film.