In MYOB, this feature is called job costing. You need to set up the jobs in Lists | Jobs, and then start to assign jobs to all codes starting with a 4,5,6,8 or 9 (just P&L codes). Job costing is not mandatory, you can set a preference if you wish to be warned if you have not job costed. You can only cost to one set of jobs. What I mean by this is if you were Coles Supermarkets and you wanted to job cost by location (i.e. City, Mt Gravatt) and also by food product group (i.e. meat, dairy, confectionery) it would not be possible to assign two jobs to each transaction. You would have to decide which activity was more important.
In Xero, this feature is called Tracking Categories. To set up tracking, go to Settings | General Settings | Tracking. Set up your title here (such as Location) and then the possible answers to this title (City, Mt Gravatt). Xero allows multiple tracking categories so in the earlier example you would be able to assign both the location and the food group to each individual transaction.