Attacking a grappled/grappling character

The Pathfinder system has improved rules for handling grappling but I ran into a situation where a character was grappled and another character wanted to hit the grappling monster with a melee attack. It seems like there should be a penalty or chance to hit the other party in the grapple when attacking.

The rules clearly define what the grappling/grappled party can/cannot do (and any penalties/bonuses they get) but I can't find anything that talks about how it would affect incoming attacks (be they ranged/melee) into the grapple.

Is there an official Pathfinder ruling and if so what is it?

-

So that would put you at a -4 to ranged attacks (unless you have Precise Shot), and would make it easier to hit the creature with a melee attack (because of the -4 to Dex).