In Biblical times, חצר meant two different things (and was even pronounced two different ways): a closed area outside a building, or a village (among other things, an open area).
Today’s usage of חצר as yard or backyard follows the first meaning.
החצר שלנו מגודרת בשיחים.
Our yard is fenced in with bushes.
חצר means yard, but if you want to get more specific and refer to a backyard, you’d use חצר אחורית . Likewise for front yard, it’s חצר קדמית (even if it’s not fenced in).
Note that although it doesn’t have the classic ה- ending, חצר is a feminine noun.