GRAPE: Generalizing Robot Policy via Preference Alignment