Most desktop environments use Freedesktop.org MIME Actions spec. Every program has a .desktop file in /usr/share/applications and/or ~/.local/share/applications, providing information about the program and the MIME types it accepts. User's own preferences are kept in ~/.local/share/applications/defaults.list.
URI schemes, such as http: or mailto:, are simply listed as special x-scheme-handler/scheme MIME types. (Older programs may still be using GNOME- or KDE-specific URI scheme databases, though.)
Some "traditional" mail programs, such as Alpine or Mutt, still use the older ~/.mailcap file for determining the best tool to view attachments with. This is partially because they are purely terminal-based, and require different mechanisms.