Heroic Act of Charity
The Heroic Act of Charity is when a member of the Roman Catholic church offers to God all the satisfactory value of prayers and good works performed during their lifetime plus all the suffrages which may accrue to him after his death for the remission of the souls in purgatory. The "satisfactory value" of a good work is its value with regard to making up for one's sins and reducing a person's stay in Purgatory. The term "Purgatory" does not indicate a Place, but a Condition of Existence.

Scripture
Offering prayers for the dead is found in 2 Maccabees 12:43-46:He then took up a collection among all his soldiers, amounting to two thousand silver drachmas, which he sent to Jerusalem to provide for an expiatory sacrifice. In doing this he acted in a very excellent and noble way, inasmuch as he had the resurrection of the dead in view; for if he were not expecting the fallen to rise again, it would have been useless and foolish to pray for them in death. But if he did this with a view to the splendid reward that awaits those who had gone to rest in godliness, it was a holy and pious thought. Thus he made atonement for the dead that they might be freed from this sin. Praying for the dead is among the Spiritual works of mercy.

Background

The souls in purgatory can do nothing for themselves. They can no longer merit or give satisfaction or receive the sacraments or gain indulgences. Charity to the suffering souls involves the mystery of the communion of saints:

A decree of the Sacred Congregation of Indulgences dated 18 December, 1885, and confirmed by Leo XIII, says that "The Heroic Act of Charity in favour of the souls detained in purgatory consists in this, that a member of the Church militant (Christifidelis), either using a set formula or simply by an act of his will, offers to God for the souls in purgatory all the satisfactory works which he will perform during his lifetime, and also all the suffrages which may accrue to him after his death." It is a pious custom for those particularly devoted to Mary, to make it a practice to deposit the said suffrages as it were into the hands of the Blessed Virgin that she may distribute these favours to the souls in purgatory according to her own merciful pleasure.  It should not be made lightly, but only after serious reflection.

This can be done either using a set formula or by a simple act of will. It suffices to have the intention and to make it from the heart. As it is in the nature of an offering rather than a vow, it is revocable. 

By this act one voluntarily resigns everything that might in any way be acceptable to God as atonement for the punishment incurred by one's own sins. By doing this, one forgoes the lessening of his own time in Purgatory, hence the title Heroic Act. A somewhat frightening thought, one who makes the Heroic Act effectively offers to spend time in Purgatory on behalf of others, as he renounces all opportunities to remit temporal punishment for himself, although there remains the reasonable hope that God in His goodness, and the sainted souls in their gratitude, will not allow the punishment to be exacted to the full. The application of prayers for the souls in  Purgatory is subject to the disposition of the will of God. By making this act with purity of intention, one is relying upon the mercy of God. A person who has made the Heroic Act may still pray for himself, friends and other intentions. 

This practice was encouraged by a number of Popes including  Benedict XIII (1728), Pius VI (1788) and Pius IX (1852).