The geoid is an imaginary surface that is approximately mean sea level, if mean sea level could be extended under the continents. The geoid is defined by measurements of gravity, rather than sea level. The surface of the geoid represents the places where gravity exerts equal force, i.e. an equipotential surface.
The geoid is affected by large masses such as mountains and by density variations in the earth's crust, and therefore is not a completely smooth surface.
Long term measurements showed that sea level was an unreliable reference for vertical measurements. In addition to long term changes in sea level due to global warming and cooling, sea level is affected locally by prevailing winds and currents. By using measurements of gravity rather than sea level, a more stable reference geoid can be obtained.
Most modern ["vertical datum"]s use the geoid as the reference surface rather than mean or local mean sea level. Just as there are various different horizontal datums, there have been different standard geoids, basd on ever more precise measurements and technological advancements.