MIDI includes both a specification of circuitry and cabling to connect one device (keyboard, sampler, synth, etc.) to another, as well as a binary data message format to send on that circuitry and cabling.
TCP/IP MIDI uses the binary message format defined for MIDI and instead sends it over a TCP/IP socket connection, usually from one networked computer to another.
To learn about MIDI (including SYSEX messages), search for “MIDI Fanatic’s Technical Brainwashing Center” and you will find (a mirror of) jglatt’s (nearly) comprehensive MIDI site.
The TCP/IP bit is more in the realm of computer science.