Every host gets a score between 0 (nothing free) and 1, the weighted average of four measures: free CPU in MHz, free CPU as a percentage of that host's capacity, free memory in MB, and free memory as a percentage of that host's memory. The host with the highest score wins. The two absolute (MHz, MB) measures are compared with the best of the candidate hosts, so the host with the most free MHz gets 1 for that measure; the percentage ones use each host's own capacity.
Raise this to favour hosts with more spare CPU in absolute terms, e.g. a large host that is as busy, percentage-wise, as a small one.
If all four weights are zero (the default), the original ranking applies: the host whose busier resource, CPU or memory, is the least used by percentage. The build console log lists every host considered with its score, and why any host was ruled out.