Matt,
The ground connection is one of the bell housing to motor bolts on the transmission. Find which bolt is closest to the ground wire and attach it there. Just make sure that the connector does not spin when you tighten the bolt.
BTW, just for information, a battery harness from an auto equipped X3 is different from a manual X3. The positive wire on the manual harness is a little bit longer to get around the shifter mechanism. I figured that out when I swapped harnesses around from my parts car (auto) to my driver (manual).
Dean