Question: I have been playing around with google app engine and its datastore recently and created a datamodel and relationships using reference properties. 

However I am unclear about the concept of ancestors wrt the datastore. What is their purpose and why should I use them? How do they relate to reference properties of datastore entities?

Answer: 
Another benefit of entity groups/ancestors is to create islands of strong consistency (as opposed to eventual consistency).

For instance, you could have a project and its tasks. Without ancestors, you could 'close' a task, go back to the tasks list screen for the project, and do a query for open tasks. The task you just closed could still show up because of eventual consistency. The query may have been resolved against a server where the update still hasn't been replicated.

However, with ancestors you get strong consistency. So, instead of a simple foreign key from task to project, you make the the project the ancestor for the project tasks. Now, when querying for tasks, you make it an ancestor query by also providing the project key. The result will be strongly consistent and the task you just closed won't ever be part of the result.
Providing an ancestor makes your (new) entity part of the same entitygroup as the ancestor provided. Hence all entities with a common root entity as an ancestor get stored in the same datastore node, this 'locality' permits numerous actions to be performed on all these entities (in the same entitygroup) all within a transaction. Then to any query which contains an ancestor query (such as only return entities which are children the common root entity) , these actions will appear to occur simultaniously (atomically) or not at all.

Ref:
<http://www2.mta.ac.il/~kirsh/download/MTA%20NoSQL%20Seminar/Lectures/GAE.pdf>