"To know the difference" means having the ability to distinguish or recognize the contrast between two or more things, ideas, or situations. Full definition
If they didn't know the difference between good and evil then god is a real jerk for punishing all of humanity for their actions. (religion.blogs.cnn.com)
Your defense system gets so overwhelmed and confused that it literally doesn't know the difference between what's good and what's bad. (elizabeth-finch.com)
They are so used to you telling them the rules, they don't know the difference in context when you tell them to break the rules. (fatmovieguy.com)