GameMaker Marching Squares Implementation
Download it as an asset package
This wiki page not only provides a better description than what I could probably give, it also provides some useful tables and details on how you can write your own implementation.
The idea is this: We have an isovalue, and we want to draw lines through a square that would semi-accurately depict where the isovalue would cut through the square based on the current and neighboring squares' values.