Spam is detected by YouTube depending on the wording of the comment posted or the behavior of that commenter. For example, continually publishing comments within a short time frame might be considered spam.
YouTubers now have more power over the comments posted on their videos. They have the option of reviewing your comment before it is posted or removing it entirely.