For this you will need to use javascript to verify that the value of the fields is equal at the time the confirmation field is filled. The name of this event is onBlur
.
The implementation would be in this idea:
HTML and Javascript:
<form id="formulario">
<input type="password" id="senha"> Senha <br/>
<input type="password" id="confirma_senha" onBlur="verificaIgual()"> Confirma Senha <br/>
</form>
function verificaIgual(){
var senha = document.getElementById('senha');
var confirma = document.getElementById('confirma_senha');
if(senha.value != confirma.value){
alert("As senhas devem ser iguais");
}
}