Memory management is a pretty complicated subject, but basically a 32 bit operating system is built around an address space of 32 lines. 2^32=4GB.
But it is worse than that. Intel CPU's use memory mapped input/output - devices are assigned address space that then cannot be used for memory.
The end result is that you generally have around 3.25 - 3.5 GB RAM available.
64 bit OS can address 2^64 or 4GB*4GB or a bunch of RAM, well 16 exabites (16 x 10^18). Limitation is generally the motherboard.