When this option is unselected, you get a notification only if you’re mentioned by someone who is listed in your Contacts or is someone you previously received messages from.
See Manage downtime in Screen Time on Mac