It has to do with the salt suppressing the bitter/sour flavors, which brings out the sweetness even more. Think of how cantaloupe can be served with (salty) prosciutto as an appetizer.
Supposedly it makes more of a difference when added to a less ripe melon, and left to soak a bit (ideally mixed into a pile of cut melon balls/cubes/whatever) but honestly I just eat ripe ones and don't bother with salt myself, so I'm not sure.