I am not entirely sure if you are asking about implementation hints (I can't help you there) or more specifically about the zip code boundaries.
In any case, the Census Bureau provides so-called zip code tabulation areas which are polygonic approximations of zip codes. I say approximations because zip codes are really points on a map and may not conform to neat boundaries as typically seen on a map. Nonetheless, they provide the approximation, pretending they are areas.
So, to your question, Google presumably translates the address to lat/longs, then checks for spatial membership in any number of 'neighborhood' layers, including neighborhood proper, zip code, probably others. If you searched for a specific zip code, their parser recognizes that as such and returns the corresponding feature from the tabulation area shapefile, and returns the corresponding polygon.
Zip code tabulation areas can be fetched here: