When an atom that has nuclear spin is placed in a strong magnetic field, the nucleus's magnetic moment will line up either parallel (lower energy) or anti-parallel (higher energy) to the external field. The atom can absorb a photon with an energy equal to the energy difference between the spin states to flip between the spin states. The greater the external magnetic field, the greater the difference in energy between the spin states.
Greater electron density around a nucleus causes the nucleus to be "shielded" meaning that it experiences a weaker applied magnetic field. Hence, the energy difference in spin states is greater for a proton with a lot of electron density, and smaller for an proton with little electron density.
In Proton NMR, chemical shift measures the difference in proton shielding relative to tetramethyl silane (TMS) a compound with 12 identical, very heavily shielded protons. The sample protons will be less shielded, and the chemical shift number is a measure of how much less. There are tables of rough chemical shifts for protons in different functional groups.