*EDIT: And looking further, it seems someone else has identified other sources so maybe my hypothesis doesn't hold. That article gives much better insight than I do. (The page is also 4 years old, but the most relevant post I could find.)
Doing a few random searches, it looks like all the answers come from the same sets of sources. My educated guess would be that Google has already determined sources which are trustworthy/reliable and have written algorithms to parse/search these resources and return these results in an order which is consistent with its other search algorithms.
I base this hypothesis on that I haven't seen any sources outside of these specific ones in approx 10 different searches:
This page offers some addditional suggestions on how to properly identify definitions in your HTML however the no conclusion was reach on how Google sources these definitions.