That is a gesture of dominance. Horses were designed to live in herds so that they could rely on one another to keep each other safe from predators, and much like dogs or wolves, there is a pecking order in a herd of horses. There is an alpha horse, the one who makes all the decisions for the herd and is the most trusted. You'll often see the alpha horse pinning it's ears at other horses sometimes kicking them or getting them to move out of the way. This isn't the horse "bullying" the other horses as most people think; the alpha horse is simply reasserting it's dominance. Horses are always more comfortable when they know where they stand in the herd hierarchy. They don't need to be babied, they need for you to be the leader and make the decisions, and then they will feel comfortable around you.
A horse sees you, the human, as part of the herd. You and the horse, when you are together, are a herd of two. When your horse hits you with the back of its head, it's a dominant gesture. The horse is saying, "I'm the leader, I make the decisions, now get out of my way!" She's doing this because you've never taught her that YOU are the leader. There can never be two equal positions in a herd. Since you've never stepped up and said, "Excuse me horse, I am the leader, and you are not," the horse is going to assume the position of alpha over you.
Now you might wonder, what's so bad about the horse being the leader over you? Well, without the discipline and respect that comes from you being the leader, the horse's behavior quickly becomes dangerous. A leader horse would NEVER let a horse that is lower on the totem pole invade their space without permission. Since you let your horse invade your space without permission by letting her hit you, you're saying to her, "Okay, okay, fine. You win." The horse will quickly learn that it is okay to boss you around, and can lead to behaviors such as biting, kicking, rearing, pushing you, etc., which is all very dangerous.
Now, just because she invaded your space or disrespected you DOESN'T mean you should start hitting her over and over again, get angry, or beat her, or take away her feed, etc. Its not her fault that she is playing her role as leader. The next time she goes to hit you, immediately turn around to face her, look her sternly in the eye, say, "NO!" and back her up. Get her out of your space. You can do this by marching towards her, or raising your arms, and if all else fails, you can push her out of your space. Consistency is the key; you have to consistently correct all her disrespectful behaviors. Sometimes it can take a long time before she finally figures out that you're the leader; don't give up! Horses don't need democracy, they need leadership and trust, and this means spending lots of time with her as well, even if you don't do anything with her.
I really highly encourage you to look up the book "The Soul of a Horse" by Joe Camp. The guy who wrote it was in a similar situation as you are, and it's a really helpful and insightful book. Also look up Monty Roberts, Clinton Anderson, and whatever other natural horsemen you can find.