The diff in the back of a compact is known as a small case diff(168mm) and if you do a engine swap then the rear diff doesn't last very long, small case diffs(168s) are fitted in 316,318,318is and 320s.
Medium case diffs(188mm) are fitted in 323i, 325i and 328i.
Large case diffs are fitted to most V8s, e46 M3 and the e36 EVO M3
e24, e28, e30 and Z diffs can all be fitted in the compact.(188s)
E28, E30 and Z diffs are best to swap in for better gearing, you can get a 3.46lsd from an e28.(188) the E28 rear mount plate will need to be replaced with a e30 mount plate for the Ti.
E28, E30, All Z3, and the 318ti all have the same designed rear cover, which are interchangeable between themselves.