If you are foreign and female in China, you are foremost foreign. Foreigners are in many cases (and often thankfully) removed from the social constraints and expectations that most Chinese operate on. However, foreign females are treated differently than foreign males. Females are more protected and restrained by their employers and friends, but can also use that attitude to their advantage.
Foreign women working in China are more protected by their employers. People are much more worried about where women go and what they do. While it is nice to have this support structure, it can be frustrating to more independent western women who would like to try doing things on their own. While the constant worrying can be frustrating, it also means women get invited to go more places with Chinese escorts, which often has the advantages of being easier, cheaper, and more authentic.
With friends and at social events, women are not pressured into as many things as males. This is particularly true with drinking. While it is virtually impossible for a male to leave a banquet sober, it is relatively easy for a female to refuse alcohol, even at banquets. Females can also avoid playing drinking games or giving impromptu speeches. However, no one can get out of singing ka la OK (that's karaoke to you) because the Chinese seem to believe that all Westerners have wonderful voices.
The main advantage to being female is that you are not seen as a threat. Males have a really difficult time being trusted by any Chinese. In part because I am female, I can make Chinese friends and get to know about their lives. I get invited to homes and out to dinner. The foreign males I know have a much harder time getting involved in the lives of Chinese.
On the street, women seem to be less of a target for heckling or insults from Chinese men who want to appear macho, but are not protected from people trying to overcharge them.
I'm not sure if there are differences in safety for foreign males and females. There are huge differences for Chinese males and females. Most of the Chinese females I know who live in the city do not go out alone after dark. Generally, even though crime rates are rising, foreigners in China are very safe because the punishments for crimes against foreigners are much higher than punishments for crimes against Chinese.
If you are female in China you may feel uncomfortable because of sexual advances in dance clubs. Chinese male dancers can be *very* persistent especially if they are drunk and if they are rich businessmen who are used to having their way. They will try to (literally) drag you onto the dance floor to dance with them. You will not be able to refuse with a simple shake of your head or pulling your hand away (which you won't be able to do anyway, if they have your wrist). The best defense is to come with a male friend (preferably foreign) and cling to them when you need to.
The only other time I've felt uncomfortable is with businessmen at banquets (remember, most of the men get drunk at these events). There is nothing you could outright scream about, but there is people sitting much closer than necessary and people leaning in a bit closer than I'm comfortable with. Because these things are difficult to articulate and I don't like making a scene at formal occasions, I try to sit with other females and use every opportunity to maintain my personal space.