Hi Clara,
There are two types of costs and two stages at which you can get costs.
The types of costs are lawyer/client and party/party. Lawyer/client include fees and charges that are required throughout the course of the matter. This includes filing fees, photocopying, serving fees, secretary fees etc. You will need to pay these fees per your arrangement and seek reimbursement at the end of trial should you win. How you get reimbursement is through party/party costs. This means that the losing party pays for their own costs as well as the costs of the other party (winning party). In theory, they should be reimbursing all your lawyer/client costs should you win. In practice, the other side may dispute your lawyer/client costs as unreasonable and ask for taxation. In this case, the court determines what is reasonable by looking through each item of your bill and awards accordingly. This is all done at the very end of the trial after handing down the decision.
The other stage in which you can be awarded costs is during trial, where you conduct proceedings called "interlocutory proceedings". These proceedings are concurrent to the main trial (hearing). They include applications to dismiss the other side's case for lack of merit, application to extend time, application to have expert witnesses etc. Not every trial has them but if you do, the costs are usually decided at the end of each interlocutory proceeding. The judge decides whether to award costs promptly to the one party (i.e. the party successful in the interlocutory proceeding) or to delay costs, called "costs in the cause", which means that whomever ultimately wins the trial is awarded costs for this interlocutory proceedings by the other side. Such costs are reimbursement of lawyer/client costs (i.e. lawyers' fees as well as disbursements such as filing fees, third party agent fees etc).
Note that in practice, parties usually recover around 2/3 of their actual expenditure through the taxation process. Ask your lawyer to explain this to you should you have any questions. Your lawyer is obliged to make sure you understand everything you need to know about costs and keep you updated at regular intervals on cost projections and approximately how much you have already spent. Also, the $4,000 the lawyer quoted should be broken down to you or at least explained how this is calculated.