A hostile witness is a specific definition, and certain things (like leading the witness) become allowed once a witness is designated as hostile. Categorizing a witness as hostile (and the resulting different rules about how lawyers can treat them) is a matter of law introduced via a rule by the Supreme Court. You can read more about this in the federal rules of evidence
here.
The judge decides if the witness is hostile based on the witness's actions/behavior. There isn't one specific definition written in the law, but generally agreed-upon characteristics are out there. I liked
this article about it. (Final comment is that it is much more than just being angry or coming off as irritated, which is what I used to think!)
Edit because I accidentally said federal rules of engagement when I meant evidence.