Okay, I think I'm beginning to understanding it.
So, に follows the word which is the 'thing' being compared with/related to some 'other thing'. In the examples above, that 'other thing' is marked by the topic marker は, or if not, is implied by context (e.g. 兄に比べると背が低い, その事件に関係している).
I'm guessing in my example "昼ごはんになにがたべたいですか", the first 'thing' is lunch and the 'other thing' is what wants to be eaten.
Let me know if I'm wrong anywhere here Tori. Thanks a lot.