Ability to hide content from subsets of users using BBCode

How could this even be implemented server-side, since anyone can see a post’s raw contents?