This is a constitutional law question. I am presuming we are talking about speech. Generally, limitations on speech, where allowed, must be no greater than necessary, and must be "viewpoint neutral."
That means that the limitation cannot depend on the content of the speech--the "viewpoint" of the speaker.
For example, if you allow speech in a park, you might legitimately limit the volume level, but you could not allow people who like hamburgers to speak without also allowing vegetarians to speak (or vice versa). A law allowing hamburger eaters to speak but not allowing vegetarians to speak would violate viewpoint neutrality and would be struck as unconstitutional. Such a law would discriminate based on the viewpoint of the speaker (meat is good v. meat is bad).
It is the constitution itself (the highest law in the United States) that prevents viewpoint discrimination.
However, be aware that the issue is very subtle. Private people in their own associations can limit expression. Even government owned areas like army bases can limit expression. There are all sorts of cases on what place (or forum) is appropriate for speech limitations. In places where speech may be limited, viewpoint discrimination may be legal.
Hope the overview helps!