The object of eating or drinking is marked with を. Note that 飲む (drink) covers not just liquids but also medicine and soup, where English uses 'take' or 'eat'.
[Food/Drink] + を + 食べる/飲む
朝ごはんにパンを食べます。
Asagohan ni pan o tabemasu.
I eat bread for breakfast.
朝ごはんに (for breakfast, に marks the occasion) + パンを (bread, object) + 食べます.
毎日薬を飲みます。
Mainichi kusuri o nomimasu.
I take medicine every day.
薬を飲む literally 'drink medicine' — Japanese uses 飲む even for pills.
晩ごはんに魚を食べました。
Bangohan ni sakana o tabemashita.
I ate fish for dinner.
晩ごはんに (for dinner, に marks the occasion) + 魚を (fish, object) + 食べました.
• Medicine rule: In Japanese you 飲む (drink) medicine, not 食べる, even for solid pills. 薬を飲む. • Meal words: 朝ごはん (morning meal), 昼ごはん (noon meal), 晩ごはん / 夕ごはん (evening meal). ごはん literally means 'cooked rice' but by extension 'meal'.
The JLPT rarely asks whether you recognise a pattern — it asks which of several similar patterns fits. These are the ones を is tested against.
食べる is for chewing solids; 飲む covers liquids, soup (スープを飲む), and medicine/pills, so its range is wider than English 'drink'.
を marks the direct object being eaten/drunk; は would instead topicalize the food to talk ABOUT it (パンは食べません = as for bread, I don't eat it).
Study Japanese grammar on LenGaki

Get the Android app
The app adds offline study, home-screen widgets, stroke-order tracing, speaking practice with pronunciation scoring, and an AI tutor that answers questions in context — none of which fits in a browser tab.