forum post count is a simple variable, shown somewhere on the profile page or together with user info that's displayed in posts, that gets increased when the user in question posts, and (not on all forums) decreased if their post gets removed; it's easy to tie various site features and user rewards to how high/low the number is (here it gets you out of "new user - suspected bot/spammer" category, gives you the next cosmetic title tier, and at certain milestones rewards you with complimentary trophy points)
on more organized forums you get rules dictating discussion do's and no-no's (so the threads don't get derailed by small talk, etc.), but it's common to still give users some space to engage openly with each other in a more relaxed manner (chatting, forum games like counting to an arbitrary number, sometimes any topics that may not relate to the overall theme of the forum); said area/subforum is usually exempt from affecting the post count (to not reward users for small talk and other inane stuff with whatever the post count might be tied to); here it's a subforum called offtopic, and it's what the "messages don't count" note that's a part of the
offtopic thread template (that not all thread posters keep) means
profile comments (misleadingly called profile posts on xenforo, the forum engine this website uses) are a newer-for-forums concept borrowing from social media that's also meant for small talk.
if a forum comes with an integrated realtime chatroom, replying there is likewise not considered posting.
private messages generally don't count for the post count either since they're hard to moderate and can't be used for dick measuring contests (community engagement).