This has been implemented as follows:
When the teams are unbalanced, the game will attempt to select a "best-fit" player to move over to the other team. This way, if the game is unbalanced, both in player count and skill, it will hopefully be better after the auto-switch.
The algorithm is this:
player score ratio = (5 * caps + 2 * grabs + kills + 1) / (deaths + 1)
team score ratio = (team 1 score + 1) / (team 2 score + 1)
The player with the closest score ratio to the team score ratio is selected for the autobalance. For example, if the score was 21 to 10, and a player left the team with 10 points, causing the teams to be unbalanced, and you had 2 grabs (4 points), 1 cap (5 points), 12 kills (12 points), and 10 deaths, you'd be a "perfect fit", because your ratio (22/11, or 2:1) would exactly match the team score ratio. The +1's on everything are just to help balance out the low numbers so a 1/0 is not an infinite score ratio.
With 1.928, time on the map is taken into account as well. 1 is added to the ratio difference for every 5 minutes of play. So, say in the above example, you've been playing on the map for 10 minutes. Now, instead of having a ratio difference of 0 (perfect match), your ratio difference is 2.
If somebody else joined in, and was only playing for a minute, and got, say, 1 kill and 1 death (2/2 or 1:1 score ratio), his ratio difference would be 22/11 - 2/2 = 1, plus 0.2 (1/5 minutes) for time, resulting in a total of 1.2, lower than your 2, so he would be auto-switched instead.
Trying to write all this out makes it sound more complicated than the code used to implement it, but I figured I'd share exactly how it works. I'm not sure if those are the best numbers to use, but at least it tries to find an ideal candidate to switch.
Cvar settings:
g_autobalance 0 - disabled
g_autobalance 1 - autobalance enabled. Players will be autoswitched when player counts are unbalanced by more than 1.
g_autobalance 2 - autobalance enabled, team switching to a team with the same number or more players disallowed.