Projects can be associated with retainers. When creating a new project you have the option to select an Account (the customer). If the selected account has any retainers (recall, retainers are always associated with accounts), then you can select which retainer you want to associate with the project.
The Retainer dropdown menu will show you all retainers associated with the selected account ("Acme Company" in the screenshot above). After a retainer has been associated with a project you can start logging time and expenses against the retainer. That is, any time logs and expenses that are associated with the retainer project will be associated with the retainer. (NOTE: this depends on how you set up your retainer.) The date of the time log or expense will determine the retainer instance in which the time log or expense is associated.
It's important to note that you can have multiple projects associated with the same retainer, and likewise, a project can be associated with multiple retainer instances. It's ultimately the date on which a time log or expense is created that determines the retainer instance to which it is applied.