IF 1 of the 2 parties who tries to control a province already controls a province bordering that one, while the other party doesnt have that, the one that controls a bordering province will get it. (controls, not owns)
IF both parties control a province bordering OR both dont control a province bordering it AND one of the 2 is human, the other AI, the AI will always get it.
IF both parties are human OR both parties are AI, AND they both control a province bordering it OR they both dont control a province bordering it, AND one of them has a general, while the other hasnt, the one with the general will get it.
IF both parties are human OR both parties are AI, AND they both control a province bordering it OR they both dont control a province bordering it, AND both have a general, the one with the best general will get it. (Like it worked in EU2, however, I have no idea what the game considers to be a 'better' general.)
IF both parties are human OR both parties are AI, AND they both control a province bordering it OR they both dont control a province bordering it, AND both dont have a general, the party that was there first will get the province.
Now there is in a single player verses AI game one way you can use this. For example: If you are the Netherlands, and the UK declares war on Prussia, and you then declare war on Prussia as well. You occupy the provinces bordering the prussian provinces at the northwestern prussian coast (but not the coastel ones!). The UK AI is programmed to land its troops on the northwestern prussian coast. It will land its troops there, but as the province doesnt border a province controlled by the UK, but borders a province controlled by you, they will start controlling it for you. Then as soon as it is controlled by you, and there troops are on your territory, the AI is programmed to send them to your control, so you get more free troops to fight the UK, and you dont have to waste troops to occupy the coast! (Note: you dont have to be in an alliance for this to work!)