EDI just stands for Electronic Data Interchange and is the most general of all your terms. It can mean any electronic submission between trading partners. This is usually in a plain text format, but not necessary. Though X12 is a standard for EDI, a CSV
file would also be EDI.
X12 is a standard messaging format (kind of like SMTP or HTTP). It defines the syntax of how a message is composed and how the syntax of the control segments that give meta data about the file that is being interchanged. There are X12 committees that define
X12 standards for over 300 transaction sets. I think the latest they are working on is the 6020.
The x12 standard of an 837 is a generic structural standard for what types of loops and segments a health care claim X12 can contain. This is represent well here:
There are 3 "implementations" of the 837 which dictate more details about how the 837 is expected to be used and the allowed qualifiers that translate into specific business meaning. These are Dental, Professional (equivalent of HCFA1500 form) and
Institutional (equivalent of UB04 form). Some of these implementations contradict each other, but they all meet the generic X12 837 standard. Anyone can create an "implementation" of an X12 standard as long as their trading partners agree to use
it. Many businesses were using or are still using the 4010 version of the 837 implementation guide.
As part of mandates in HIPPA for portability, a new standard was proposed and adopted called the X12 837 5010. Everyone was required to switch over to this as of last year who wants to do business with the federal government. The two main reasons for this new
standard is to support the migration from ICD-9 to ICD-10 which is immanent, and to require all providers to use their NPI as their identifier. Some trading partners met this my upgrading their systems to create 5010, others still submit 4010 to their Clearinghouses
and ask that they do the conversion before sending to their trading partners. This technique will be less meaningful once ICD-10 becomes a requirement.
837's are typically the standard for transactions when someone is expecting payment from someone else. But there are still plenty of proprietary formats for exchanging smaller subsets of claim data for other purposes, especially business intelligence use cases.
This is even more true when clearinghouses are not involved.