In essence, the cost basis of a set of shares is the amount that was spent acquiring those shares.
Moneydance currently supports Average Cost and Lot-based Cost calculations.
You can choose either "Avg. Cost" or "Lot Matching" when creating or editing a security.
Average Cost
This is the simplest calculation method.
Shares are assumed to have a cost basis equal to the average price paid for the security, times the number of shares.
This is the default selection in Moneydance.
Lot Matching
This calculation method allows you to select which buy transactions (and individual shares within those transactions) were used to purchase the shares for each sale.
This is the appropriate method to use the FIFO (First In, First Out) method of tracking your shares.