I'd take it like this: Something(S) + comes (Vi) + in (Adverb) + handy (Adjective functioning as subject complement).
So it has essentially the same structure as "It looks good", "That sounds right", etc.
If I recall correctly what I learned from high school grammar book, there are five sentence patterns in English, as shown. "come in handy" belongs to the #4 pattern.
1. S + V-i "I exist" (S=subject, V-i=intransitive verb).
2. S + V-t + O "I love you" (V-t=transitive verb, O=object).
3. S + V-t + O-i + O-d "I sent him a letter" (O-i=indirect object, O-d=direct object).
4. S + V-i + C-s "I am a student", "It looks good" (C-s=subject complement).
5. S + V-t + O + C-o "He knocked me unconscious" (C-o=object complement).