Some cards have effects that prevent specific creatures from attacking or blocking unless a cost of some kind is paid. For example, the controller of a Ghostly Prison cannot be attacked unless the attacking player pays two generic mana for each attacking creature. This cost is paid when attackers are declared, it is not something that uses the stack or can be responded to.
Similarly, many creatures have abilities that prevent them from attacking or blocking if a specific condition is not met. For example, Bloodcrazed Goblin can’t attack unless an opponent has been dealt damage this turn. In order for the Goblin to attack this condition must be true when attackers are declared. You cannot attack with Bloodcrazed Goblin and then deal damage to an opponent in order to make this attack legal. This means that in order to attack with the Goblin, you need to deal damage to an opponent before the declaration of attackers step.
The difference between these two types of abilities is one deals with a cost and the other a condition. Costs can be paid whenever a spell or ability requires it. However in order to take an action legally, all conditions must be met to allow it before the action is taken.