I'm starting a Research Track IM residency in a couple of months. You're a loooong ways off from residency, so things may change before you get there. But at the moment, there are ABIM Research Tracks for both general IM and subspecialty IM. As DarkProtoman described, the general IM track essentially lets you substitute 2-3 years of research for the 3rd clinical year of the IM residency. You still need to pass the boards the same as every other IM resident, though. This track is much less common than the subspecialty track, because there are vanishingly few basic scientist-GIM docs, and few (if any) GIM divisions are basic-science oriented.
The more common track is through a subspecialty. You do two years of IM, then 1-2 years of clinical fellowship (depending on the subspecialty). After that, you are committed to 3 years of lab work in order to be qualified for board certification. However, you are guaranteed 90% protected time during these years (max one-half day of clinic per week). The idea is that by then you will have independent funding and be ready for appointment to a very-junior faculty spot in your subspecialty. This is often referred to as the "short-track", because it lops off the usual 3rd year of IM residency and puts you right into a fellowship - although at 6-8 years it's not exactly short, and not necessarily any shorter than a standard IM residency + subspecialty fellowship.
Short-track programs are often wrapped up within "physician-scientist training programs" (PSTP) to make them work more smoothly. Fellowship slots are filled a year ahead of start dates, so short-trackers would need to apply for fellowship during intern year! These programs therefore often integrate residency and fellowship applications so that you are interviewed by your fellowship of interest simultaneously with your residency interview, with some sort of preferred access to fellowship programs at the institution you match at. Most academic IM departments have some flavor of PSTP, often with other enticements like career mentoring and guaranteed funding support during the lab years. Confusingly, PSTPs typically neither require short-tracking, nor are the only avenue to short-tracking. The goal is to provide a seamless bridge between MD or MD/PhD graduation and junior faculty.
The differences between the traditional track and the short-track are really pretty subtle. The traditional path is 3 years of IM residency + 3-5 years of fellowship, of which the last 2-3 are spent in lab if you want to launch a research career. But the two parts are separate - you do your IM residency, can be boarded in IM, and apply separately to fellowships. You can take time off, work for a while, go to a different city, whatever. Fellowship programs vary widely in how strongly they support research with positions, money, and protected time. The short-track is usually one big gulp - all at the same place, no intervening application process, usually PSTP infrastructure, with IM and subspecialty certification intertwined. I decided on the Research Track largely for this security - it's easy enough to fall off the physician-scientist path, and while short-tracking removes some flexibility it also removes several failure points (more accurately, compresses them all into the residency match).