In a word, STPP.
I used to do racetrack safety work, and white clothing was required. I would ride my motorcycle to the track. I found that moderately hot water (130F) and a detergent with phosphates (STPP) got the road and bike grime off the jeans, leaving the spotless. Then the mfg pulled the phosphates from the detergent, and I noticed that the jeans were no longer getting clean. It took a while for me to find out the missing ingredient, Sodium Tri Poly Phosphate (STPP for short), but since I found it I know that it gets most types of dirt on whites out.
Now, some stains won't be removed by STPP. Thinks like some plant dyes. For these, a good oxygen bleach might help. I don't use chlorine bleach, because of its harsh effects on fabrics. And it isn't very effective on road grime anyway.