Reseting a button counter when pressed 3 times

The State Change Detection example can detect the moment that a button was pressed or released. That moment (an event) is what you need.
To make use of the State Change Detection, you have to put your code in there, not at the end.

In your sketch, you call twice digitalRead(), but there is only one button. It is better to get that information just once.
For a good code flow, it is often easier to collect all information at the beginning of the loop().
With "all information" I mean sensors and also if a button is pressed or not.

Do you mind if I put the line "lastButtonState = buttonState;" inside the if-statement. I like it more that way :stuck_out_tongue:

const int buttonPin = 6;
const int buzzer = A3;
int buttonPushCounter = 0;   // counter for the number of button presses
int buttonState = 0;         // current state of the button
int lastButtonState = 0;     // previous state of the button

void setup()
{
  Serial.begin(9600);        // initialize the LED pin as an output:
  pinMode(buzzer, OUTPUT);   
  pinMode(buttonPin, INPUT); // initialize the pushbutton pin as an input
}

void loop()
{
  buttonState = digitalRead(buttonPin);
  if (buttonState != lastButtonState)
  {
    // if the state has changed, increment the counter
    if (buttonState == HIGH)
    {
      // if the current state is HIGH then the button went from off to on:
      buttonPushCounter++;
      Serial.println("on");
      Serial.print("number of button pushes: ");
      Serial.println(buttonPushCounter);


      // ---------------------------------------------------------------
      // Add here code to run when a button has been pressed just now
      // ---------------------------------------------------------------
      if (buttonPushCounter >= 3)
      {
        Serial.println("The button has been pressed three times");
        tone(buzzer, 1000);
        Serial.println("resetting the counter");
        buttonPushCounter = 0;
      }
    }
    else
    {
      // if the current state is LOW then the button went from on to off:
      Serial.println("off");

      // ---------------------------------------------------------------
      // Add here code to run when a button has been released just now
      // ---------------------------------------------------------------

      // It would be nicer to call noTone() only when it is buzzing at the moment,
      // but for now the noTone() is called every time the button is released.
      noTone(buzzer);
    }
    // save the current state as the last state, for next time through the loop
    lastButtonState = buttonState;
  }

  // Delay a little bit to avoid bouncing and slow down the sketch
  delay(10);
}

Please keep your text layout nice and tidy. Set all the indents, spaces and comma's at the right place. It is almost impossible to make a reliable sketch when the text layout is a mess.