To match shares sold with those bought. An investor may buy shares in a stock slowly over a number of years at many different prices. When he/she sells some of those shares, he/she identifies which shares he/she intends to sell. This is done to minimize his/her capital gains tax liability. For example, suppose an investor buys 5,000 shares at $10 per share and 5,000 shares at $20. If this investor later decides to sell 3,000 of her 10,000 shares at $25, she will likely identify the shares as the ones bought at $20. This means that her profit is only $5 per share instead of $15. That means her capital gains taxes will be less than it otherwise would have been.
To distinguish which shares among those that are owned are to be sold. An investor may buy shares of a company or mutual fund at many different prices over a period of years. If a portion of those shares are to be sold, the investor may identify shares so as to control the profits or losses that are realized. In addition, an investor who identifies shares having the highest cost basis often can minimize the taxes associated with such a sale.