In cryptography, a salt is a random value added to a password before hashing to ensure that identical passwords produce different hash outputs, thereby defending against rainbow table attacks. Salts are crucial for enhancing password security by making precomputed hash attacks infeasible and ensuring that each user's password hash is unique, even if they use the same password.