Keep it simple and sincere: "I just heard you got engaged. That's wonderful. Congratulations! " Then follow up with a basic question, such as, "When is the wedding? " Try to sound genuinely happy and interested. A handshake or hug is appropriate, too, depending on your relationship with the other person.
Usually you try to keep it fairly simply. "Congratualtions on your engagement! I'm so happy for you! You guys are perfect for eachother!" or "Congratulations on your new baby! He/she really is beautiful." or "Welcome to motherhood/fatherhood. You'll be a great parent!"