The HRE asked me to join in their war. I refused and then looked at who they were attacking and I noticed there were trying to claim an independent county somewhere in the Alps (forget the name). So I thought, why not. I found a claimant for the county, invited him to court, gave him a spare city I had and declared war on the same county myself. This made HRE hostile to me because of conflicting wargoals. Fair enough. We ended up fighting each other instead of the county (I eventually snuck one stack in to seige the county and used another to run interference and stop HRE from doing the same).
Later, I noticed BE was waging a holy war against an independent pagan country somewhere around Hungry. So, again, I thought why not and declared my own holy war against the same. But in this case, BE did not become hostile and we both laid siege to the same county (BE occupied 2 of 4 holdings, I took the other 2, but BE ended up winning the war - they had a head start).
So why did I get the hostile due to conflicting war goals in the first case, but not in the second? How can I tell when being opportunist and trying to declare war on a county already at war if I'm going to set off a massive conflict with another neighbor?