The bèi structure in Chinese is similar to the passive voice in English. However, English passive voice sentences are commonly rendered in Chinese as topic-comment sentences.
菜吃完了。
cài chī wán le 。
The food has been eaten.
教室打扫干净了。
jiāo shì dǎ sǎo gàn jìng le 。
The classroom has been swept clean.
The bèi structure comes into play (1) when an ‘agent’ is introduced into the sentence or (2) the speaker adopts a narrative stance and describes how something has happened:
(1) bèi with an agent:
菜被我吃完了。
cài bèi wǒ chī wán le 。
The food was finished by me.
教室被学生们打扫干净了。
jiāo shì bèi xué shēng men dǎ sǎo gàn jìng le 。
The classroom was swept clean by the students.
(2) bèi in a narrative sentence:
菜被吃完了。
cài bèi chī wán le 。
The food was eaten (by someone).
教室被打扫干净了。
jiāo shì bèi dǎ sǎo gàn jìng le 。
The classroom was swept clean (by someone).
In the sentence “菜吃完了。cài chī wán le。”, the speaker takes a commentative stance, observing that the food has been finished and there is none left. By contrast, in the sentence “菜被吃完了。cài bèi chī wán le 。”, the speaker adopts a narrative stance, and is saying what has happened to the food, i.e. it has been eaten by somebody.
[1] Yip, P. C., Rimmington, D., Xiaoming, Z., & Henson, R. (2009). Basic Chinese: a grammar and workbook. Taylor & Francis.