Normal Arduino boards do not have an analog output.
There is a library that can set a volume for a tone. It does that by changing the PWM signal. It is not a 'real' volume, but it can be useful. http://playground.arduino.cc/Code/ToneAC
ToneAC is something special, it used TIMER1, and it used both the outputs of TIMER1 to double the maximum volume. The piezo tweeter should be connected to those two pins. You can't use PWM output that uses TIMER1.
That are a lot disavantages, you have to consider that when making a project with it.
To answer your question, you have to tell us more. Which Arduino board ? Why do you want to change volume with a beeper ? Do you want only 2 volumes, or maybe in about 10 steps ? What is your sketch ? How are the other pins connected ?
I am using Arduino Uno board. I want to change the volume of the buzzer because the sound it produce is really high, it does not match our project.
I need only 1 volume, constant. Other pins are connected as inputs, simply inputs. Pins 6-9 are inputs for a push button. Pin 10 is for logic input from external circuit. Pins 12, 11, 5, 4, 3, 2 is for LCD. The rest are available pins.
That would help lower the sound of the buzzer? I've read the code given in the link above, and I thought it was the frequency of the buzzer that is changing. Or I get it wrong?