Generals seem to acquire good traits from being in the field, fighting battles, in the case of your faction leader recruiting agents, etc. While in settlements they acquire useful retinue members and negative traits.

This is however subject to a disclaimer that it has not been carefully tested and is based on purely anecdotal evidence.