Conventional lead acid batteries produce hydrogen gas as a byproduct of the charging process. This gas tends to collect in and around the battery. As you are aware making the final connection can generate a substantial spark. By making the frame connection the point where the spark occurs it is far enough from the hydrogen gas to avoid an explosion.
I don't know the actual justification, but to me it makes sense to always attach positive first because it is easy to accidentally touch the lead to something else while installing. If the negative lead were already attached, then touching the positive lead to just about anything on the car that is metal would short out the battery.
Simple, the car is always connected to the negative terminal of the attached battery meaning if you connect a charged battery's negative to amother car first, the whole car chassis will be connected to that charged battery's negative. This means that if you accidentally touch the positive terminal to any part of the car except the positive terminal, there's a high chance of a shirt circuit, arc and ultimately a weld, a second dead battery and possible burn marks on the person. Now vice versa, if you connect the positive terminal first, you can touch the negative terminal of the charged battery to any part of the "dead" car without shorting the charged battery. This is much safer.
Positive has greatest potential. Connect negative fisrt, positive can arc and fuse. Connect positive first, negative having less potential won't arc. The higher the voltage, the greater the chance of arcing and fusion.
On a car if negative first and you are touching any metal part of car, when attaching positive there is possibility of arcing through you. Your body becomes part of the circuit.
Think of positive like the Marines, first in, last out.
Be safe, don't die of stupidity.